/***
 * dtree数据填充
 */
var Tree = {
		rootName:"根节点名称",
		data:{},//树的数据
		checkNodes:[],
		domName:"",
		disable:false,
		init:function(option){
			this.data = option.data;
			this.rootName = option.rootName;
			this.checkNodes = option.checkNodes;
			this.domName = option.domName;
			this.disable = option.disable == null ? false : option.disable;
			var d = new dTree(option.treeObjName);
			d.add(0,-1,this.rootName);
			this.createNode(d,this.data);
			return d;
		}
		,createNode:function(treeObj,list){
			if(list==null || list== undefined || list.length==0){
				return ;
			}
			for (var i = 0; i < list.length; i++) {
				var parentId = list[i].parentId==null?0:list[i].parentId;
				
				var isCheck = this.isCheck(list[i].id);
				treeObj.add(list[i].id,parentId,this.domName,list[i].id,list[i].resName,isCheck,this.disable);
				if(list[i].child==null){
					continue;
				}
				this.createNode(treeObj,list[i].child);
			}
		}
		,isCheck:function(nodeId){
			rs = false;
			if(this.checkNodes!=null && this.checkNodes !=undefined && this.checkNodes.length>0){
				for (var i = 0; i < this.checkNodes.length; i++) {
					if(this.checkNodes[i] == nodeId){
						rs = true;
					}
				}
			}
			return rs;
		}
}